summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-12-18 21:38:50 +0100
committerLiam <byteslice@airmail.cc>2023-12-23 03:52:49 +0100
commitc57ae803a6e04f303c168292aaf727ccb61e5de2 (patch)
tree2f959b67638ab1134cfca19ac1f041552a68c335
parentkernel: restrict nce to applications (diff)
downloadyuzu-c57ae803a6e04f303c168292aaf727ccb61e5de2.tar
yuzu-c57ae803a6e04f303c168292aaf727ccb61e5de2.tar.gz
yuzu-c57ae803a6e04f303c168292aaf727ccb61e5de2.tar.bz2
yuzu-c57ae803a6e04f303c168292aaf727ccb61e5de2.tar.lz
yuzu-c57ae803a6e04f303c168292aaf727ccb61e5de2.tar.xz
yuzu-c57ae803a6e04f303c168292aaf727ccb61e5de2.tar.zst
yuzu-c57ae803a6e04f303c168292aaf727ccb61e5de2.zip
-rw-r--r--src/core/hle/kernel/k_client_port.cpp4
-rw-r--r--src/core/hle/service/ipc_helpers.h4
-rw-r--r--src/core/hle/service/sm/sm_controller.cpp7
3 files changed, 7 insertions, 8 deletions
diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp
index 9b20c4d75..68cea978a 100644
--- a/src/core/hle/kernel/k_client_port.cpp
+++ b/src/core/hle/kernel/k_client_port.cpp
@@ -58,8 +58,8 @@ Result KClientPort::CreateSession(KClientSession** out) {
KSession* session{};
// Reserve a new session from the resource limit.
- KScopedResourceReservation session_reservation(
- GetCurrentProcessPointer(m_kernel)->GetResourceLimit(), LimitableResource::SessionCountMax);
+ KScopedResourceReservation session_reservation(GetCurrentProcessPointer(m_kernel),
+ LimitableResource::SessionCountMax);
R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
// Allocate a session normally.
diff --git a/src/core/hle/service/ipc_helpers.h b/src/core/hle/service/ipc_helpers.h
index 0e222362e..4b02872fb 100644
--- a/src/core/hle/service/ipc_helpers.h
+++ b/src/core/hle/service/ipc_helpers.h
@@ -151,8 +151,8 @@ public:
if (manager->IsDomain()) {
context->AddDomainObject(std::move(iface));
} else {
- kernel.ApplicationProcess()->GetResourceLimit()->Reserve(
- Kernel::LimitableResource::SessionCountMax, 1);
+ ASSERT(Kernel::GetCurrentProcess(kernel).GetResourceLimit()->Reserve(
+ Kernel::LimitableResource::SessionCountMax, 1));
auto* session = Kernel::KSession::Create(kernel);
session->Initialize(nullptr, 0);
diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cpp
index 7dce28fe0..7f0fb91d0 100644
--- a/src/core/hle/service/sm/sm_controller.cpp
+++ b/src/core/hle/service/sm/sm_controller.cpp
@@ -28,7 +28,6 @@ void Controller::ConvertCurrentObjectToDomain(HLERequestContext& ctx) {
void Controller::CloneCurrentObject(HLERequestContext& ctx) {
LOG_DEBUG(Service, "called");
- auto& process = *ctx.GetThread().GetOwnerProcess();
auto session_manager = ctx.GetManager();
// FIXME: this is duplicated from the SVC, it should just call it instead
@@ -36,11 +35,11 @@ void Controller::CloneCurrentObject(HLERequestContext& ctx) {
// Reserve a new session from the process resource limit.
Kernel::KScopedResourceReservation session_reservation(
- &process, Kernel::LimitableResource::SessionCountMax);
+ Kernel::GetCurrentProcessPointer(kernel), Kernel::LimitableResource::SessionCountMax);
ASSERT(session_reservation.Succeeded());
// Create the session.
- Kernel::KSession* session = Kernel::KSession::Create(system.Kernel());
+ Kernel::KSession* session = Kernel::KSession::Create(kernel);
ASSERT(session != nullptr);
// Initialize the session.
@@ -50,7 +49,7 @@ void Controller::CloneCurrentObject(HLERequestContext& ctx) {
session_reservation.Commit();
// Register the session.
- Kernel::KSession::Register(system.Kernel(), session);
+ Kernel::KSession::Register(kernel, session);
// Register with server manager.
session_manager->GetServerManager().RegisterSession(&session->GetServerSession(),